Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating away from java.util.Date to java.time - DateTimePickerFragment #4552

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rapterjet2004
Copy link
Contributor

@rapterjet2004 rapterjet2004 commented Dec 17, 2024

#4274

Migrating to java.time would remove so much code in DateTimePickerFragment that I figured I might as well also convert the dialog fragment to compose too. Honestly looks and feels way better now.

  • Added DateTimeCompose
    • Embedded the Date and Time pickers into the dialog
  • Removed DateTimeFragment + XML
  • Now uses java.time for all-in-one timezone handling + more robust features, instead of java.util.Calendar and java.util.TimeZone

Core logic

        val laterToday = LocalDateTime.now()
            .withHour(18)
            .withMinute(0)
            .withSecond(0)

        val tomorrow = LocalDateTime.now()
            .plusDays(1)
            .withHour(8)
            .withMinute(0)
            .withSecond(0)

        val thisWeekend = LocalDateTime.now()
            .with(nextOrSame(DayOfWeek.SATURDAY))
            .withHour(8)
            .withMinute(0)
            .withSecond(0)
        
        val nextWeek = LocalDateTime.now()
            .plusWeeks(1)
            .with(DayOfWeek.MONDAY)
            .withHour(8)
            .withMinute(0)
            .withSecond(0)
       
issue-4274.webm

🚧 TODO

  • Delete the old fragment + xml
  • Making the labels strings res
  • Checking the offset from datePicker
  • Theming

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@rapterjet2004 rapterjet2004 added the 2. developing Work in progress label Dec 17, 2024
@rapterjet2004 rapterjet2004 self-assigned this Dec 17, 2024
@rapterjet2004 rapterjet2004 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 19, 2024
@rapterjet2004 rapterjet2004 marked this pull request as ready for review December 19, 2024 15:32
- Also converted dialog fragment to compose

Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Added string res
Fixed bug with embedded date picker boundaries, animated size change

Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
@rapterjet2004 rapterjet2004 force-pushed the issue-4274-migrate-javautil-date-time-1 branch from 99f1c46 to bcb7b60 Compare December 20, 2024 14:53
Signed-off-by: rapterjet2004 <[email protected]>
Signed-off-by: rapterjet2004 <[email protected]>
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4552-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings158162
Errors7171

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1616
Dodgy code7171
Internationalization33
Malicious code vulnerability33
Performance44
Security11
Total104104

Lint increased!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant